package com.dycn.posdashboard.dbhelper;

/**
 * 用ThreadLocal类实现在不同线程中数据库访问上下文的保持和获取
 * @author gongqiyi
 *
 */
public class DbContextHolder {
    private static final ThreadLocal<String> contextHolder = new ThreadLocal<String>();   
    
    public static void setDbSource(String dbSource) {   
        contextHolder.set(dbSource);   
    }   
  
    public static String getDbSource() {   
        return (String) contextHolder.get();   
    }   
  
    public static void clearDbSource() {   
        contextHolder.remove();   
    }   
}
